//
//  MyProgressView.m
//  SmileRead
//
//  Created by dllo on 15/9/3.
//  Copyright (c) 2015年 JIZ. All rights reserved.
//

#import "MyProgressView.h"

@interface MyProgressView ()

@property (nonatomic, retain) UIView *progressView;
@property (nonatomic, retain) UIView *bufferprogressView;

@end

@implementation MyProgressView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.bufferprogressView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0.01, self.frame.size.height)];
        self.bufferprogressView.backgroundColor = [UIColor grayColor];
        [self addSubview:self.bufferprogressView];
        [_bufferprogressView release];
        
        self.progressView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0.01, self.frame.size.height)];
        self.progressView.backgroundColor = [UIColor blueColor];
        [self addSubview:self.progressView];
        [_progressView release];
    }
    
    return self;
}

// 重写setter方法
- (void)setProgressOfOn:(float)progressOfOn
{
    self.progressView.frame = CGRectMake(0, 0, progressOfOn * widthFit, self.frame.size.height);
}

- (void)setProgressOfUp:(float)progressOfUp
{
    self.bufferprogressView.frame = CGRectMake(0, 0, progressOfUp * widthFit, self.frame.size.height);
}

- (void)dealloc
{
    [_bufferprogressView release];
    [_progressView release];
    [super dealloc];
}



@end
